﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FCT551.Base;

namespace FCT551.Models
{
    /// <summary>
    /// IO调试类
    /// </summary>
    public class DiDoStatusModel : NotifyPorperChanged
    {
        public Action<DiDoStatusModel, bool> _action;
        private string _displayText;
        private bool oldvalue;

        public string DisplayText
        {
            set
            {
                _displayText = value;
                this.SetProperty();
            }
            get => _displayText;
        }

        private bool _status;

        public bool Status
        {
            set
            {
                if (!this.IsbackGround)
                {
                    if (this.IsDo == true)
                    {
                        _action?.Invoke(this, value);
                    }
                }
                _status = value;
                this.IsbackGround = false;
                this.SetProperty();
            }
            get => _status;
        }

        private bool _isDo;

        public bool IsDo
        {
            set
            {
                _isDo = value;
                this.SetProperty();
            }
            get => _isDo;
        }

        private int _channel;

        public int Channel
        {
            set
            {
                _channel = value;
            }
            get => _channel;
        }

        private bool _isbackground;

        /// <summary>
        /// 判断是前台还是后台修改
        /// </summary>
        public bool IsbackGround
        {
            set
            {
                _isbackground = value;
            }
            get => _isbackground;
        }

        private DiDoType _type;

        public DiDoType Type
        {
            set
            {
                _type = value;
            }
            get => _type;
        }
    }

    public enum DiDoType
    {
        Common,
        ThreePointThree,
        TwoFour
    }
}